package com.framework.file.service.impl;

import com.framework.file.model.SysFileFolder;
import com.framework.file.repository.SysFileFolderRepository;
import com.framework.file.service.ISysFileFolderService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Log4j2
@Service
public class SysFileFolderService implements ISysFileFolderService {
    @Autowired
    private SysFileFolderRepository sysFileFolderRepository;

    @Override
    public String save(SysFileFolder folder) {
        folder = sysFileFolderRepository.save(folder);
        return folder.getId();
    }

    @Override
    public List<SysFileFolder> list(String module) {
        List<SysFileFolder> list = sysFileFolderRepository.findByModuleOrderBySort(module);
        return list;
    }
}
